angular.module('app').controller('favoriteCtrl', ['$http', '$scope', 'dict', function ($http, $scope, dict) {
    ajax_pos();
    function ajax_pos(params) {
        $http({
            url: 'data/myFavorite.json',
            method: 'GET',
            params: params,
            //data:params
        }).then(function (res) {
            $scope.positionList = [];
            if (params && !params.all) {
                for (var i = 0, len = res.data.length; i < len; i++) {
                    var item = res.data[i];
                    if (item[params.key] == params.id) {
                        $scope.positionList.push(item);
                    }
                }
            } else {
                //console.log(res);
                $scope.positionList = res.data;
            }

        }, function (error) {
            console.log(error);
        });
    }
}]);

